#pragma(once)

#include<iostream>
#include<queue>
#include<list>
#include<deque>
#include<memory>
using namespace std;
namespace learn 
{
namespace polymorphic {
//虚基类
class Base 
{
public:
    Base() {cout<<"Base called"<<endl;}
    virtual ~Base() {cout<<"~Base called"<<endl;}
    virtual void externalPort(int &){}
protected:
    virtual void pureService(int &) = 0;
    virtual void service(int &){}
private:
    std::priority_queue<int>baseQueue;
    friend void polyTest(void);
};

class Derive1 : virtual public Base
{
public:
    Derive1(){cout<<"Derive1 called"<<endl;}
    virtual ~Derive1() {cout<<"~Derive1 called"<<endl;}
    virtual void externalPort(int &){}
protected:
    virtual void pureService(int &) {cout<<"Derive1 pureService called"<<endl;}
    virtual void service(int &){}
private:

};

class Derive2 : virtual public Base
{
public:
    Derive2(){cout<<"Derive2 called"<<endl;}
    virtual ~Derive2(){cout<<"~Derive2 called"<<endl;}
protected:
    virtual void pureService(int &) {cout<<"Derive2 pureService called"<<endl;}
    virtual void service(int &){}
private:

};

class Derive3 : public Derive1, public Derive2
{
public:
    Derive3();
    virtual ~Derive3();
protected:
    virtual void pureService(int &){cout<<"Derive3 pureService called"<<endl;}
    virtual void service(int &){}
private:
    friend void polyTest(void);
};

void polyTest(void);

}
}